﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZBJF.Warranty.Model;
using ZBJF.Warranty.Model.ViewModel.Order;
using ZBJF.Warranty.Model.ViewModel.Product;

namespace ZBJF.Warranty.IBLL
{
    public partial interface IInsuranceOrderService
    {
        InsuranceOrder LoadByID(long id);
        //bool IsExist(string thirdOrderNo, ref InsuranceOrder entity);
        /// <summary>
        /// 根据第三方保单号查询保单信息是否存在
        /// </summary>
        /// <param name="thirdUniqueNumber"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool IsExistByThirdUniqueNumber(string thirdUniqueNumber, ref InsuranceOrder entity);
        /// <summary>
        /// 根据IMEI号或IDFV获取工单信息
        /// </summary>
        /// <param name="searchNo"></param>
        /// <returns></returns>
        InsuranceOrder LoadByIMEIOrIDFV(string searchNo);

        //InsuranceOrder LoadByThirdOrderNo(string thirdOrderNo);
        /// <summary>
        /// 根据获取工单信息
        /// </summary>
        /// <param name="thirdUniqueNumber">第三方保单号</param>
        /// <returns></returns>
        InsuranceOrder LoadByThirdUniqueNumber(string thirdUniqueNumber);
        /// <summary>
        /// 根据获取工单信息
        /// </summary>
        /// <param name="thirdUniqueNumber">第三方保单号</param>
        /// <param name="ID">销售商ID</param>
        /// <returns></returns>
        InsuranceOrder LoadByThirdUniqueNumber(string thirdUniqueNumber,long ID);
        /// <summary>
        /// 根据获取工单信息
        /// </summary>
        /// <param name="thirdUniqueNumber">第三方保单号</param>
        /// <param name="ID">销售商ID</param>
        /// <returns></returns>
        InsuranceOrder LoadBySellerBusinessNo(string sellerBusinessNo, long ID);
        /// <summary>
        /// 根据获取工单信息
        /// </summary>
        /// <param name="ID">销售商ID</param>
        /// <param name="IMEI">设备识别码IMEI</param>
        /// <returns></returns>
        List<InsuranceOrder> LoadByIMEI(long ID, string IMEI);

        InsuranceOrder LoadByPhoneAndCertificateNO(string orderPhone, string certificateNO);
        /// <summary>
        /// 根据用户信息判断保单是否有效（1. 判断订单是否生效 2. 判断订单是否在有效期内 3.判断是否理赔过）
        /// </summary>                    
        /// <param name="orderPhone"></param>
        /// <param name="certificateNO"></param>
        /// <param name="orderId"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        bool ValidateCreateAccident(string orderPhone, string certificateNO, out long orderId, ref string msg);

        InsuranceOrder Load(string cardNo, string cardPassword);
        /// <summary>
        /// 根据产品ID获取销量：非取消的订单
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        //int LoadSellQtyByProductID(long productID);

        IQueryable<InsuranceOrder> GetPagingList(InsuranceOrderModel model, out int total);

        /// <summary>
        /// 审核保单——尺度销售商
        /// </summary>
        /// <param name="">保单号</param>
        /// <param name="">是否通过</param>
        /// <param name="">最后修改时间——并发控制</param>
        /// <param name="">最后审核人账号</param>
        /// <param name="">最后审核人姓名</param>
        /// <returns></returns>
        bool UpdateInsuranceOrderStatus(long insuranceOrderId,bool isPass,DateTime lastModifyTime,string opUserName);
    }
}
